<template>
	<view class="container">
		<view class="header align-center justify-between plr14 ft16">
			<view :class="act==0?'on flex1':'flex1' " @click="changeAct(0)">
				我的培训
			</view>
			<view :class="act==1?'on flex1 middle':'flex1 middle' "@click="changeAct(1)">
				历史培训
			</view>
		
		</view>
			<view class="search bgWhite plr15 ptb10">
				<view class="align-center searchbox justify-between">
					<uv-input placeholder="请输入课程名称查询" v-model="classdata" border="none" placeholder-style="color:#969696"></uv-input>
					<uv-icon @click="getList" name="search" size="30" color="#969696"></uv-icon>
				</view>
			</view>
		

		
		<view style="height: 240rpx;">
		
		</view>
		
		<view class="plr15">
			<view class="pxList flex-wrap justify-between">
				<navigator hover-class="none" class="bgWhite posRelative plr10 ptb10 pxitem  "
					v-for="i in dataList " :url="'/pages/studyMain/index?id='+i.id" >
					<image src="/static/images/img_internet.png" mode=""></image>
					<view class="flex1 flex-col ">
						<view class="clamp2 title">
							{{i.title}}
						</view>
						<view class="start radius5 mt5">
							报名开始:{{i.starttime}}
						</view>
						<view class="end radius5 mt5">
							报名截至:{{i.endtime}}
						</view>
					</view>
				
				</navigator>
				
				
			</view>
			<uv-empty v-if="dataList.length==0"></uv-empty>
	</view>
</view>
</template>

<script>
	let app = getApp();
	export default {
		components: {

		},
		data() {
			return {
				act:0,
				list: [
					'https://cdn.uviewui.com/uview/swiper/swiper1.png',
					'https://cdn.uviewui.com/uview/swiper/swiper2.png',
					'https://cdn.uviewui.com/uview/swiper/swiper3.png',
				],
				dataList:[],
				classdata:""
			}
		},
		onLoad(opt) {


		},
		
		onShow() {
			this.getList()
		},
		mounted() {



			// 使用函数生成一个正弦波形


		},

		methods: {
			changeAct(type){
				this.act=type
				this.getList()
			},
			getList(){
				this.$api.myUserInfo({type:	this.act+1,class:this.classdata}).then(res=>{
					console.log(res)
					this.dataList=res.data
				})
			}
		}





	}
</script>
<style scoped lang="scss">
	page {
		color: #343434;
	}

	.header {
		width: 100%;
		height: 110rpx;
		background-color: #fff;
	
		box-sizing: border-box;
		color: #969696;
		position: fixed;
		top: 0;
		left: 0;
		z-index: 999;
		display: flex;
	
		view {
			text-align: center;
			font-size: 28rpx;
			height: 100%;
			display: flex;
			align-items: center;
			justify-content: center;
		}
	
		.on {
			color: #000;
			position: relative;
		}
	
		.on::after {
			content: "";
			width: 20rpx;
			height: 4rpx;
	
			background: #0082DB;
			position: absolute;
			bottom: 0;
			left: 0;
			right: 0;
			margin: auto;
	
		}
	
		.middle {
			position: relative;
		}
	
	
	
		.middle::before {
			content: "";
			width: 2rpx;
			height: 30rpx;
			background: #E0E0E0;
			position: absolute;
			top: 0;
			bottom: 0;
			margin: auto;
			left: 0;
		}
	}
	.grid {
		box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.1);
		height: 340rpx;
		font-size: 24rpx;
		color: #343434;

		.griditem {
			width: 25%;
			height: 170rpx;
			display: inline-flex !important;
		}

		image {
			width: 90rpx;
		}
	}

	.lookmore {
		color: #B6B6B6;
		font-size: 24rpx;
		line-height: 24rpx;
	}

	.pxitem {
		box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.1);
		margin-top: 20rpx;
		width: 335rpx;
		box-sizing: border-box;
		border-radius: 18rpx;
		color: #333;
		font-size: 24rpx;

		view {
			font-size: 24rpx;
			// color: #0082DB;

			// margin: 20rpx 0 30rpx;
		}

		.title {
			font-size: 32rpx;
			font-weight: bold;
		}

		image {
			width: 306rpx;
			height: 236rpx;
			border-radius: 18rpx;
			margin-right: 20rpx;
			flex-shrink: 0;
		}

		.allPeo {
			position: absolute;
			color: #06355B;
			background-color: rgba(255, 219, 109, .95);
			top: 20rpx;
			left: 240rpx;
			margin: 0;
			line-height: 1;
			width: 40rpx;
			text-align: center;
		}

		.start {
			background-color: #E5F2FC;
			color: #0082DB !important;
			font-size: 24rpx;
			text-align: center;
			padding: 4rpx 6rpx;
			margin-top: 20rpx;

			// width: 140rpx;

		}

		.end {
			font-size: 24rpx;
			padding: 4rpx 6rpx;
			color: #F65A58;
			text-align: center;
			background: rgba(246, 90, 88, .1);
		}
	}
	
	.searchbox {
		background-color: #f7f7f7;
		border-radius: 12rpx;
		height: 84rpx;
		width: 100%;
		padding: 0 30rpx;
	
	}

	.moduletitle {
		height: 116rpx;

		text {

			width: 6rpx;
			height: 18rpx;
			background: #0082DB;
			border-radius: .5rem;
			display: block;
		}
	}

	.pickerbox {
		background-color: #fafafa;
		width: 500rpx;
		height: 72rpx;
		color: #969696;
	}

	.tag {
		background-color: rgb(255, 219, 109);
		color: #fff;
		font-size: 26rpx;
		padding: 4rpx 8rpx;
		border-radius: 10rpx;
		margin-right: 10rpx;
	}
	.search{
		position: fixed;
		top: 120rpx;
		left: 0;
			width: 100%;
		z-index: 999;
	}
</style>